<?php

function tap_intro_page() {
    $base_path = base_path();
    $content = <<<EOF
<h2>Welcome to TAP</h2>

<p>
TAP aims to provide tools to easily create and deliver mobile tour applications in a museum setting. Content creation is performed in the content management system, Drupal. TAP tours are exportable into an intermediate format, TourML, which can then be used as pluggable bundles for mobile applications.
</p>
<br/>
<p>
Get started by <a href="$base_path/node/add/tour">Creating your first tour</a> or
<a href="https://code.google.com/p/tap-tours/">Reading the documentation</a>
</p>
<br/>

EOF;

    $content .= drupal_get_form('tap_intro_form');
    return $content;
}

function tap_intro_form() {
    $form['hide'] = array(
        '#type' => 'checkbox',
        '#title' => 'Hide this page',
    );

    $form['submit'] = array(
        '#type' => 'submit',
        '#value' => 'Submit',
    );
    $form['#redirect'] = 'tours';

    return $form;
}

function tap_intro_form_submit($form, &$form_state) {

    if ($form_state['values']['hide'] == 1) {
        variable_set('site_frontpage', 'tours');
    }

}
